import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';
import ListView from '../views/home/ListView';
const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: '/index',
    children: [
      { path: '/detail', component: () => import('../views/home/DetailView') },
      { path: '/Login', component: () => import('../views/home/LoginView') },
      { path: '/reg', component: () => import('../views/home/RegView') },
      { path: '/releasehouse', component: () => import('../views/home/ReleaseHouseView') },
      { path: '/house', component: () => import('../views/home/HouseView') },
      { path: '/list', component: () => import('../views/home/ListView') },
      { path: '/renthouse', component: () => import('../views/home/RentHouseView') },
      { path: '/hotcity', component: () => import('../views/home/HotCityView') },
      { path: '/userdetail', component: () => import('../views/home/UserDetailView') },
      { path: '/detail', component:() => import('../views/home/UserDetailView')  },
    ]
  },
  { path: '/index', component: () => import('../views/index/IndexView') },
  {
    // 使用参数来区分不同的列表视图
    path: '/list/:viewType',
    name: 'ListView',
    component: ListView,
    // 你可以在这里添加一个 redirect，如果需要的话
    // redirect: { name: 'ListView' },
    // 或者你也可以在这里添加一个 resolve 函数来预加载数据
    // resolve: {
    //   viewType: () => import('../views/ListView.vue')
    // }
  },
  // 这里可以添加更多路由
];
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});
export default router;
